import request from '@/utils/request';

// 请求用户分页列表
export const reqGetUserList = (page, limit) => {
    return request.get(`/admin/acl/user/${page}/${limit}`)
}

// 请求用户分页列表
export const reqSearchUser = (page, limit, username) => {
    return request.get(`/admin/acl/user/${page}/${limit}?username=${username}`)
}


// 请求添加用户
export const reqAddUser = (userInfo) => {
    return request.post(`/admin/acl/user/save`, userInfo)
}

// 根据用户id  获取角色数据
export const reqRoleListByUserId = (userId) => {
    return request.get(`/admin/acl/user/toAssign/${userId}`)
}

// 根据用户分配角色
export const reqAssignRolesByUserId = ({ userId, roleId }) => {
    return request.post(`/admin/acl/user/doAssign?userId=${userId}&roleId=${roleId}`)
}

// 请求修改用户
export const reqUpdataUser = (userInfo) => {
    return request.put(`/admin/acl/user/update`, userInfo)
}
// 请求删除用户
export const reqDeleteUser = (id) => {
    return request.delete(`/admin/acl/user/remove/${id}`)
}